let table_name = "boss_order_table";
let table_data_url = "/sys/boss/order/list";
let number_list = "<'row'<'#mytool.col-xs-3'><'col-xs-9'>><'row'<'.col-xs-12'tr>><'row'<'#num_menu.col-xs-2'l><'col-xs-10'p>>";

function action_status() {
}

let dataManage = {
    currentItem: null,
    fuzzySearch: true,
    getQueryCondition: function (data) {
        let param = {};
        param.nickName = $('#nick_name').val();
        param.start = data.start;
        param.length = data.length;
        return JSON.stringify(param);
    },
};

let returnData = {
    getDate: [
        {
            className: "ellipsis",
            data: "",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "serialNumber",
            render: function (data, type, row, meta) {
                if (isNotNull(row.applyRefundTime)) {
                    return DateUtils.formatterDateNoTime(new Date(row.applyRefundTime));
                }
            },
            orderable: false,
            width: "50px"
        },{
            className: "ellipsis",
            data: "applyRefundTime",
            render: function (data, type, row, meta) {
                if (isNotNull(row.applyRefundTime)) {
                    return DateUtils.formatterDateNoTime(new Date(row.applyRefundTime));
                }
            },
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "refundId",
            orderable: false,
            width: "50px",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
        }, {
            className: "ellipsis",
            data: "transactionId",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "positionName",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
        }, {
            className: "ellipsis",
            data: "serviceCharge",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "number",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "memberNumber",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "actualAmount",
            render: CONSTANT.DATA_TABLES.RENDER.ELLIPSIS,
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "refundAmount",
            render: function (data, type, row, meta) {
                return row.serviceCharge * (row.number - row.memberNumber);
            },
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "status",
            render: function (data, type, row, meta) {
                if (row.status === 3) {
                    return '退款申请';
                } else if (row.status === 4) {
                    return '审核通过,退款中....';
                } else if (row.status === 6 || row.status === 5) {
                    return '退款成功';
                } else {
                    return "退款失败"
                }
            },
            orderable: false,
            width: "50px"
        }, {
            className: "ellipsis",
            data: "",
            orderable: false,
            width: "50px",
            render: function (data, type, row, meta) {
                if (row.status === 3) {
                    return '<button class="btn btn-sm btn-success" onclick=update_status(' + row.id + ',4)>通过</button>';
                }else{
                    return '----';
                }
            }
        }
    ]
}

function foot_info(result) {
}

function createdRow(row, data, index) {
    if (data.role) {
        $(row).addClass("info");
    }
}

function drawCallback(settings) {
}

function search_user() {
    find();
}

function fn_draw_call_back() {
}

function update_status(orderId, status) {
    HttpUtils.post_json('/sys/boss/order/update/status', JSON.stringify({
        'id': orderId,
        'status': status,
    }), function (result) {
        success_msg("更新成功", function () {
            find();
        });
    });
}